/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package project2analisisnumerico.procesos;

import java.util.Calendar;
import java.util.GregorianCalendar;
import javax.swing.JTextArea;

/**
 *
 * @author vmelendez
 */
public class Consola {
    
    JTextArea consola = null;
    Calendar calendario = null;
    
    public Consola(JTextArea consola){
        this.consola = consola;
    }
    
    public void imprimirConsola(String texto){
        this.consola.setText(this.consola.getText() + "LOG " + this.getHora() + texto + "\n");
    }
    
    private String getHora(){
        int hora, minutos, segundos;
        this.calendario = new GregorianCalendar();
        hora =calendario.get(Calendar.HOUR_OF_DAY);
        minutos = calendario.get(Calendar.MINUTE);
        segundos = calendario.get(Calendar.SECOND);
        return "[" + hora + ":" + minutos + ":" + segundos + "] ";
    }
}
